package com.digitalchina.lxnsy.viewholder;

import android.view.ViewGroup;
import android.widget.TextView;

import com.digitalchina.lxnsy.R;
import com.digitalchina.lxnsy.entity.ServiceInfoVO;
import com.digitalchina.lxnsy.toolkit.FrescoUtil;
import com.facebook.drawee.view.SimpleDraweeView;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;

/**
 * ================================================
 * 项目名称：BigData
 * 类描述：
 * 包名：com.digitalchina.bigdata.viewholder
 * 创建人：郑皓
 * 创建时间：2017/3/23 11:45:58
 * 修改备注：
 * ================================================
 */

public class AgriculturalServiceListHolder extends BaseViewHolder<ServiceInfoVO> {

    private SimpleDraweeView simpleDraweeView;//图片
    private TextView tvServiceTitle;//标题
    //    private TextView tvServiceContent;//内容
    private TextView tvServiceDate;//日期
    private TextView tvServicePraise;//点赞数
    private TextView tvServicePageView;//浏览数


    public AgriculturalServiceListHolder(ViewGroup parent) {
        super(parent, R.layout.item_agricultural_service_list);

        simpleDraweeView = $(R.id.item_agricultural_service_images);
        tvServiceTitle = $(R.id.item_agricultural_service_tv_title);
//        tvServiceContent = $(R.id.item_agricultural_service_tv_content);
        tvServiceDate = $(R.id.item_agricultural_service_tv_date);
        tvServicePraise = $(R.id.item_agricultural_service_tv_praise);
        tvServicePageView = $(R.id.item_agricultural_service_tv_pageView);
    }

    @Override
    public void setData(final ServiceInfoVO data) {
        super.setData(data);

        FrescoUtil.showImageSmall(data.getImg(), simpleDraweeView);
        tvServiceTitle.setText(data.getTitle() != null ? data.getTitle() : "");
//        tvServiceContent.setText(data.getContent() != null ? StringUtil.stripHtml(data.getContent()) : "点击查看详情");
        tvServiceDate.setText(data.getPublishDate() != null ? data.getPublishDate() : "");
        tvServicePraise.setText(data.getPraiseNum() + "赞同");
        tvServicePageView.setText(data.getPageView() + "浏览");

    }

}
